package com.example.mybatis_generation.service.impl;

import com.example.mybatis_generation.domain.ParentList;
import com.example.mybatis_generation.dao.ParentListMapper;
import com.example.mybatis_generation.domain.vo.ParentListVo;
import com.example.mybatis_generation.service.IParentListService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author qiDing
 * @since 2021-12-14
 */
@Service
@AllArgsConstructor
public class ParentListServiceImpl extends ServiceImpl<ParentListMapper, ParentList> implements IParentListService {

    private final ParentListMapper parentListMapper;

    @Override
    public PageInfo<ParentListVo> pageListTree(Integer parentId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ParentListVo> parentListVos = parentListMapper.listParentTree(parentId);
        return new PageInfo<ParentListVo>(parentListVos);
    }


}
